using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;

[DesignerCategory("Code")]
public class ExtractDialog : Form
{
    TextBox textBox1;
    Button button1;
    Button button2;
    IContainer components;
    ToolStripMenuItem fileToolStripMenuItem;
    ToolStripMenuItem exitToolStripMenuItem;
    Archive archive;
    MyDirectoryInfo pwd;

    private class ButtonOK : Button
    {
        public ButtonOK() : base()
        {
            Location = new Point(41, 226);
            Name = "button1";
            Size = new Size(75, 23);
            TabIndex = 1;
            Text = "OK";
            UseVisualStyleBackColor = true;
        }
    }

    private class TextBoxTarget : TextBox
    {
        public TextBoxTarget() : base()
        {
            Location = new Point(41, 40);
            Name = "textBox1";
            Size = new Size(196, 20);
            TabIndex = 0;
        }
    }

    private class ButtonCancel : Button
    {
        public ButtonCancel() : base()
        {
            Name = "button2";
            Size = new Size(75, 23);
            TabIndex = 2;
            Text = "Cancel";
            UseVisualStyleBackColor = true;
            Location = new Point(152, 226);
        }
    }

    private void InitializeComponent()
    {
        components = new Container();
        textBox1 = new TextBoxTarget();
        button1 = new ButtonOK();
        button2 = new ButtonCancel();
        fileToolStripMenuItem = new ToolStripMenuItem();
        exitToolStripMenuItem = new ToolStripMenuItem();
        SuspendLayout();
        button1.Click += new EventHandler(button1_Click);
        button2.Click += new EventHandler(button2_Click);
        AcceptButton = button1;
        ClientSize = new Size(292, 273);
        Controls.Add(button2);
        Controls.Add(button1);
        Controls.Add(textBox1);
        Name = "ExtractDialog";
        Text = "Extract";
        ResumeLayout(false);
        PerformLayout();
    }

    public ExtractDialog(Archive archive, MyDirectoryInfo pwd)
    {
        InitializeComponent();
        this.archive = archive;
        this.pwd = pwd;
        textBox1.Text = pwd.dir.FullName;
    }

    private void button2_Click(object sender, EventArgs e)
    {
        Close();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        ExtractingDialog dlg = new ExtractingDialog(archive, textBox1.Text);
        dlg.Show();
        dlg.go();
        Close();
    }
}

